﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Profile;
using System.Web.Security;
using System.Net;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WDTAsg2
{
    public partial class Register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {

            }

        }

        protected void Page_ServerValidate(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {

            }

        }

        protected void ContinueButton_Click(object sender, EventArgs e)
        {
            // Direct to home page
            Response.Redirect("~/Default.aspx");
        }

        protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
        {
            // Create the profile for the user
            CustomProfile profile = CustomProfile.GetProfile();
            // Initalise because they are new
            profile.Initialize(CreateUserWizard1.UserName.ToString(), true);
            // Add details and save
            profile.Personal.FirstName = FirstName.Text;
            profile.Personal.LastName = LastName.Text;
            profile.Personal.Age = Convert.ToInt32(Age.Text);
            profile.Personal.Address = Address.Text;
            profile.Save();
        }

        protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
        {
            CreateUserWizard cuw = (CreateUserWizard)sender;
            cuw.Email = cuw.UserName;
        }
        
    }
}